public class ShiftOperation {
    public static void main(String[] args) {

        //六.移位运算
        //左移:
        int a = 0x10;
        System.out.printf("%x\n",a);
        System.out.printf("%x\n",a>>1);
        System.out.printf("%x\n",a<<1);

        System.out.printf("%x\n",a<<2);
        int a1 = 0x10;
        System.out.printf("%x\n", a1 << 1);

        int a2 = 0x10;
        System.out.printf("%x\n",a>>1);


        int b = 0xffff0000;
        System.out.printf("%x\n",b>>1);

        int b1 = 0xf0;
        System.out.printf("%x\n",b1>>1);
        int b2 = 0xff0;
        System.out.printf("%x\n",b2>>1);
        int b3 = 0xfff0;
        System.out.printf("%x\n",b3>>1);
        int b4 = 0xff0;
        System.out.printf("%x\n",b4<<1);
        System.out.println("十进制数是："+b4);

        System.out.printf("%x\n",Integer.MAX_VALUE);

        int a3 = 0xffffffff;
        System.out.printf("%x\n",a3>>>1);

        int a4 = 10;
        int b5 = 20;
        int max = a4 > b5 ? a4 : b5;
        System.out.println(max);

        int a5 = 122;
        int b6 = 111;
        int max1 = a5 == b6 ? a3 : b4;
        System.out.println(max1);

        int a6 = 10;
        int b7 = 20;
        double c = a6 > b7 ? 1 :  2.0;
        System.out.println(c);

        int a7 = 10;
        int b8 = 20;
        int c1 = a7 + (b8 - a7)>>1;
        System.out.println(c1);

        int a8 = 10;
        int b9 = 20;
        int c2 = a8 + ((b9 - a8) >>1);
        System.out.println(c2);
    }
}
